---
page_title: "cloudflare_worker_domain Resource - Cloudflare"
subcategory: ""
description: |-
  Creates a Worker Custom Domain.
---

# cloudflare_worker_domain (Resource)

Creates a Worker Custom Domain.

## Example Usage

```terraform
resource "cloudflare_worker_domain" "example" {
  account_id = "f037e56e89293a057740de681ac9abbe"
  hostname   = "subdomain.example.com"
  service    = "my-service"
  zone_id    = "0da42c8d2132a9ddaf714f9e7c920711"
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `account_id` (String) The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
- `hostname` (String) Hostname of the Worker Domain.
- `service` (String) Name of worker script to attach the domain to.
- `zone_id` (String) The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**

### Optional

- `environment` (String) The name of the Worker environment. Defaults to `production`.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
$ terraform import cloudflare_worker_domain.example <account_id>/<worker_domain_id>
```
